package com.jky.stmall.manger;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
       Scanner scanner=new Scanner(System.in);
       String s= scanner.next();
       String[] s1=s.split(",");
       int[] a=new int[s1.length];
       for (int i =0;i<a.length;i++){
           a[i] = Integer.parseInt(s1[i]);
       }
        System.out.println(function(a));
    }
    public  static int function(int[] n){
        int[] num=new int[n.length+1];
        for (int i = 0;i<n.length;i++){
            num[i+1]=num[i]+n[i];
        }
        int r=0;
        for (int i=1;i<num.length;i++){
            for (int j=i;j<num.length;j++){
                if (num[j]-num[i-1]==0){
                    r++;
                }
            }
        }
        return r;
    }

}

